#ifndef DvProcess_h__
#define DvProcess_h__

#include <opencv2\opencv.hpp>
#include "DvImage.h"

bool DvCheckPointIsColor(IplImage* _img, CvPoint _point, CvScalar _color)
{
	uchar* ptr = DV_GETPOINT_PTR(_img,_point);
	if(ptr[2] == _color.val[0] && ptr[1] == _color.val[1] && ptr[0] == _color.val[2])
		return true;
	else
		return false;
}

bool DvCheckPointIsSkin(IplImage* _img, CvPoint _point)
{
	uchar* ptr = DV_GETPOINT_PTR(_img,_point);

	double Cr = 0.5000 * ptr[2]
				- 0.4187 * ptr[1]
				- 0.0831 * ptr[0] + 128;
	double Cb = - 0.1687 * ptr[2]
				- 0.3313 * ptr[1]
				+ 0.5000 * ptr[0] +128;

	if((Cr>137 && Cr<177) && (Cb>77 && Cb<127) && 
		(Cb+0.6*Cr)>190 && (Cb+0.6*Cr)<215)
	{
		return true;
	}
	return false;
}

#endif // DvProcess_h__